#include <stdio.h>
#include <stdlib.h>

/*
* II_1.c
*
*  Created on: April, 23, 2009
*      Author: yimingliu@fudan.edu.cn
*/
typedef struct aa
{
	int data;
	struct aa *next;
} NODE;


extern NODE *createlink(int n, int m);
extern void outlink(NODE *h);

void removeMinAndMax(NODE *h)
{
	NODE *p,*min,*max;
	p=min=max=h;
	while(p->next)
	{
		if(min->next->data>p->next->data)
			min=p;
		if(max->next->data<p->next->data)
			max=p;
		p=p->next;
	}
	//remove min
	min->next=min->next->next;
	//remove max
	max->next=max->next->next;
}

void funII_1()
{
	NODE *head;
	head=createlink(8,22);
	outlink(head);
	removeMinAndMax(head);
	outlink(head);
}